/*
 * Copyright (c) 2015. For Intelligent Group.
 */

package com.intelligent.ispc.core.dto;

import com.intelligent.ispc.common.dto.AbstractValueObject;

import java.util.Date;
import java.util.List;

/**
 * Created by Peter.Li on 2015/10/10.
 */
public class SecurityUserDto extends AbstractValueObject {

    private Long id;
    private String loginName;
    private String name;
    private String status;
    private Date lastLoginTime;
    private List<RoleDto> roles;
    private Integer pageSize;


    public SecurityUserDto() {
    }

    public SecurityUserDto(Long id, String loginName, String name, String status) {
        this.id = id;
        this.loginName = loginName;
        this.name = name;
        this.status = status;
    }

    public String getRoleNames() {
        StringBuffer roleNames = new StringBuffer();

        for (int i = 0; i < roles.size(); i++) {
            roleNames.append(roles.get(i).getName()).append(",");
        }
        roleNames.deleteCharAt(roleNames.lastIndexOf(","));

        return roleNames.toString();
    }

    public void setId(Long id) {
        this.id = id;
    }

    public Long getId() {
        return id;
    }

    public String getLoginName() {
        return loginName;
    }

    public void setLoginName(String loginName) {
        this.loginName = loginName;
    }

    public String getStatus() {
        return status;
    }

    public void setStatus(String status) {
        this.status = status;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public Date getLastLoginTime() {
        return lastLoginTime;
    }

    public void setLastLoginTime(Date lastLoginTime) {
        this.lastLoginTime = lastLoginTime;
    }

    public List<RoleDto> getRoles() {
        return roles;
    }

    public void setRoles(List<RoleDto> roles) {
        this.roles = roles;
    }

    public Integer getPageSize() {
        return pageSize;
    }

    public void setPageSize(Integer pageSize) {
        this.pageSize = pageSize;
    }
}
